package com.hangxintong.common.base;

import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.List;

public class Filter implements Serializable {

    private static final long serialVersionUID = 4693858498867709763L;

    @ApiModelProperty("属性名称")
    private String name;

    @ApiModelProperty(value = "数据类型", allowableValues = "string,number,date,enum,null,list,boolean,comparestring", example = "comparestring当前紧MyBatis的模式下支持")
    private String type;

    @ApiModelProperty(value = "值")
    private String value;

    /**
     * 默认等于
     */
    @ApiModelProperty(value = "条件选择", allowableValues = "not,or,equal")
    private String condition = "equal";

    @ApiModelProperty(value = "最小值 —— type 不应该为 string， value 会被忽略。")
    private String min;

    @ApiModelProperty(value = "最大值 —— type 不应该为 string， value 会被忽略。")
    private String max;

    @ApiModelProperty(value = "枚举名称——type 为 enum是有效")
    private String enumName;

    @ApiModelProperty(value = "包含数组的值")
    private List<Object> objectList;

    public static Filter of(String name, String type, String value) {
        Filter rst = new Filter();
        rst.setName(name);
        rst.setType(type);
        rst.setValue(value);
        return rst;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getMin() {
        return min;
    }

    public void setMin(String min) {
        this.min = min;
    }

    public String getMax() {
        return max;
    }

    public void setMax(String max) {
        this.max = max;
    }

    public String getEnumName() {
        return enumName;
    }

    public void setEnumName(String enumName) {
        this.enumName = enumName;
    }

    public List<Object> getObjectList() {
        return objectList;
    }

    public void setObjectList(List<Object> objectList) {
        this.objectList = objectList;
    }

    public String getCondition() {
        return condition;
    }

    public void setCondition(String condition) {
        this.condition = condition;
    }
}
